﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace stsm
{
    static class Utilities
    {
        public static Dictionary<string, string> getOptionList(string[] arguments)
        {
            Dictionary<string, string> dictionaryToReturn = new Dictionary<string, string>();
            
            for (int i = 0; i < arguments.Length; i++)
            {

                //if an element has been added already, we won't add
                //it again, but we have to advance the location to skip
                //the duplicated argument and its value
                if (!dictionaryToReturn.ContainsKey(arguments[i]))
                {
                    dictionaryToReturn.Add(arguments[i], arguments[++i]);
                }
                else
                    ++i;
            }

            return dictionaryToReturn;
        }

        public static List<string> getFileListFromDirectory(string folderToLookAt) {

            List<string> returnList = new List<string>();
            string[] files = Directory.GetFiles(folderToLookAt,"*.jpg");

            foreach (string fileName in files) {

                returnList.Add(fileName);

            }
            return returnList;

        }
    }
}

